<template>

	<view class="content">
		<!-- 		<view class="status" :style="{height:`${statusHeight}px`}"></view>
		<view :style="{height:`${statusHeight}px`}" style="background-color: #FFFFFF;"></view>
		<view class="immgShell">
			<image class="portrait" :src="userData.headPortrait" mode=""></image>
		</view>
		<view style="background-color: #FFFFFF;height: 160rpx;"></view> -->
		<view class="masking">

		</view>
		<view class="input_box">
			<!-- 搜索框 -->
			<view class="inputBox">
				<input @confirm="search" type="text" class="phoneInput" value="" v-model="phone"
					placeholder="请输入手机号码" />
				<image @click="search" class="imageSearch" src="../../static/image/search.png" mode=""></image>
				<image @click="clear" class="imageClose" src="../../static/image/close.png" mode=""></image>
			</view>
			<text style="color:red" @click="clear">取消</text>
		</view>
		<!-- 	<view class="" v-for="i in 99">
			{{i}}}
		</view> -->
		<view class="cardContent" v-for="(item,index) in list" :key="index">
			<view class="cardText">
				{{item.petName}} {{item.phone}}
			</view>
			<view class="solid">

			</view>
			<view class="cardImg" @click="OrderClick(item)">
				<view class="imgTop">
					<view style="display: flex;">
						<image style="width: 120rpx;height: 120rpx;" :src="item.mainPicture">
						</image>
						<view class="imgCont">
							<text class="imgTextName">{{item.goodsName}}</text>
							<text>x{{item.goodsNumber}}</text>
						</view>
					</view>

					<text>￥{{item.payAmount}}</text>
				</view>
				<view class="imgBtoumm">
					订单时间:{{item.create_time}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				statusHeight: 0,
				phone: '',
				pageSize: 10,
				pageNumber: 1,
				list: [],
				isLoadMore: false,
				userData: {
					headPortrait: '../../static/logo.png'
				}
			}
		},
		onLoad(option) {
			this.phone = option.phone
			this.getData()
			this.userData = uni.getStorageSync('userData').user
		},
		// 刚开始 mounted
		onReady() {
			this.statusHeight = getApp().globalData.statusBarHeight
		},
		onReachBottom() {
			if (this.isLoadMore) {
				this.pageNumber += 1
				this.getData()
			}
		},
		methods: {
			clear() {
				console.log('delete')
				this.phone = ''
				this.list = []
				this.pageNumber = 1
				this.getData()
			},
			getData() {
				this.http({
					url: "/order/goodsOrder",
					data: {
						pageNumber: this.pageNumber,
						pageSize: this.pageSize,
						nameOrPhone: this.phone,
						pickup: 3
					},
					method: "POST",
					success: res => {
						if (res.code == 200) {
							this.list = this.list.concat(res.data.list)
							if (res.data.list.length < this.pageSize) {
								this.isLoadMore = false
							} else {
								this.isLoadMore = true
							}
						}
					}
				})
			},
			OrderClick(item) {
				console.log(item)
				uni.navigateTo({
					url: "/pages/index/orderDetails?id=" + item.id
				})
			},
			search() {
				this.pageNumber = 1
				this.list = []
				this.getData()
			}
		}
	}
</script>

<style scoped>
	.content {}

	.cardContent {
		height: 300rpxpx;
		background: #FFFFFF;
		border-radius: 5px;
		padding: 20rpx;
		margin: 25rpx;
	}

	.cardText {
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		line-height: 124rpxpx;
		color: rgba(0, 0, 0, 0.65);
	}

	.solid {
		border: 1px solid rgba(112, 112, 112, 0.14901960784313725);
		margin: 20rpx 0rpx;
	}

	.cardImg {}

	.imgTop {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.imgCont {
		flex-direction: column;
		display: flex;
		justify-content: space-between;
		margin-left: 12rpx;
		padding: 4rpx 2rpx;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #000000;

	}

	.imgTextName {
		width: 350rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.imgBtoumm {
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: rgba(0, 0, 0, 0.65);
	}

	.phoneInput {
		height: 76rpx;
		border: 1px solid #E32929;
		opacity: 1;
		align-items: center;
		border-radius: 44rpx;
		padding-left: 50rpx;
	}

	.inputBox {
		position: relative;
		width: 86%;
	}

	.input_box {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx;
		height: 110rpx;
		padding-top: 0rpx;
		background: #FFFFFF;
	}

	.imageClose {
		width: 20rpx;
		height: 20rpx;
		position: absolute;
		top: 16px;
		right: 20px;
		z-index: 100;
	}

	.inputBox .imageSearch {
		width: 24rpx;
		height: 24rpx;
		position: absolute;
		top: 30rpx;
		left: 20rpx;
	}

	.status {
		width: 100%;
		position: fixed;
		background-color: #FFFFFF;
		z-index: 9999;
	}

	.masking {
		height: 100vh;
		position: fixed;
		width: 100vh;
		z-index: -1;
		background: #FAFAF9;
		left: 0rpx;
		bottom: 0rpx;
	}

	.immgShell {
		width: 100%;
		box-sizing: border-box;
		padding: 20rpx 0;
		position: fixed;
		z-index: 9999;
		background-color: #FFFFFF;

	}

	.portrait {
		width: 60rpx;
		height: 60rpx;
		display: block;
		border-radius: 50%;
	}
</style>
